package Lee_code;

import java.math.BigInteger;

/**
 * @author blh
 * @date 2024年10月24日 10:33
 */
public class Lee_66_1024 {
    public int[] plusOne(int[] digits) {

        StringBuilder sb = new StringBuilder();
        for (int digit : digits) {
            sb.append(digit);
        }
        BigInteger num = new BigInteger(String.valueOf(sb));
        num = num.add(BigInteger.valueOf(1));
        String res = num.toString();
        int[] result = new int[res.length()];
        for (int i = 0; i < res.length(); i++) {
            result[i] = Character.getNumericValue(res.charAt(i));
        }
        return result;
    }
}
